package org.gitman.agentplatform.agent.api;

import java.util.HashMap;
import java.util.Map;

/**
 * This class is used for communicating agent's plans
 * It contains map of plans: key is table of planned to visit vertices ids
 * and value is probability of execution of this plan
 * @author gitman
 *
 */
public class AgentPlan {
	private Map<Integer[], Double> map;

	public AgentPlan(){
		map = new HashMap<Integer[], Double>();
	}
	public AgentPlan(Map<Integer[], Double> map) {
		super();
		this.map = map;
	} 	
	public Map<Integer[], Double> getPlans(){
		return map;
	}
	public void addPlan(Integer [] path, Double probability){
		map.put(path, probability);
	}
	public String getHtml(Integer currID){
		StringBuilder builder = new StringBuilder("");
		int count = 1;
		for(Integer[] plan : map.keySet()){
			builder.append("[" + map.get(plan).toString() + "]: " + currID);
			for(int i =0;i<plan.length;i++){
				builder.append("->" + plan[i]);
			}
			if(count++ < map.size()){
				builder.append("<br>");
			}
		}
		return builder.toString();
	}
}
